package com.hnevc.yanyu;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class DatagramReceiver {
	public static void main(String[] args) throws IOException {
		DatagramSocket socket = new DatagramSocket(5010);

		byte[] buffer = new byte[1024];
		DatagramPacket dp = new DatagramPacket(buffer, buffer.length);
		socket.receive(dp);

		byte[] data = dp.getData();
		int len = dp.getLength();

		String s = new String(data, 0, len);
		System.out.println(s);

		socket.close();
	}
}
